package com.supermap.guangzhou.weifang.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by XueQing Wang on 2018/5/11.
 */

public class SharedPreferencesUtil {

    private static final String name="onsiteinspection";

    private static SharedPreferences.Editor edit;
    private static SharedPreferences preferences;

    private static void init(Context context){
        preferences = context.getSharedPreferences(name, Context.MODE_PRIVATE);

        edit = preferences.edit();
    }

    public static void setString(Context context,String key,String value){

        init(context);
        edit.putString(key,value);
        edit.commit();
    }


    public static String getString(Context context,String key,String defaultValue){
        init(context);

        String string = preferences.getString(key, defaultValue);

        return string;
    }
}
